﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace DemoRenderingAjaxService.Controllers
{
    public class MyAjaxController : Controller
    {
        //
        // GET: /MyAjax/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult GetCategoriesHtml()
        {
            var db = new Models.CATALOG_DBEntities();
            var model = db.Categories.ToList();
            return PartialView(model);
        }

        public ActionResult GetCategoriesJson()
        {
            var db = new Models.CATALOG_DBEntities();
            var model = db.Categories.ToList();
            return Json(model, JsonRequestBehavior.AllowGet);
        }

    }
}
